package com.weather.yiweather.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * Created by Administrator on 2016/4/22.
 */
public class YIWeatherOpenHelper extends SQLiteOpenHelper {
     public YIWeatherOpenHelper(Context context, String name, CursorFactory factory, int version) {
        super(context, name, factory, version);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        /**
         * Province表建表语句
         */
        db.execSQL( "create table Province ("
                + "id integer primary key autoincrement, "
                + "province_name text, "
                + "province_code text)");
/**
 * City表建表语句
 */
        db.execSQL("create table City ("
                + "id integer primary key autoincrement, "
                + "city_name text, "
                + "city_code text, "
                + "province_id integer)");
/**
 * County表建表语句
 */
        db.execSQL("create table County ("
                + "id integer primary key autoincrement, "
                + "county_name text, "
                + "county_code text, "
                + "city_id integer)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
